#include "CVector3d.h"

CVector3d::CVector3d()
{
	x=0.0;
	y=0.0;
	z=0.0;
}

CVector3d::CVector3d(double rx, double ry, double rz)
{
	x=rx;
	y=ry;
	z=rz;
}

CVector3d::~CVector3d()
{
}
/** No descriptions */
double CVector3d::norma() const
{

	return sqrt(pow(x,2.0)+pow(y,2.0)+pow(z,2.0));
  
}

/*!
    \fn CVector3d::operator+(CVector3d)
 */
CVector3d CVector3d::operator+(CVector3d param)
{
   CVector3d temp;
   
   temp.x=x+param.x;
   temp.y=y+param.y;
   temp.z=z+param.z;
   
   return(temp);
}

/*!
    \fn CVector3d::operator-(CVector3d)
 */
CVector3d CVector3d::operator-(CVector3d param)
{
   CVector3d temp;
   
   temp.x=x-param.x;
   temp.y=y-param.y;
   temp.z=z-param.z;
   
   return(temp);
 
}
/*!
    \fn CVector3d::operator*(double)
 */
CVector3d CVector3d::operator*(double param)
{
     CVector3d temp;
   
     temp.x=x*param;
     temp.y=y*param;
     temp.z=z*param;
   
     return(temp);
}

/*!
    \fn CVector3d::operator(double)*
 */
double CVector3d::operator*(CVector3d param)
{
     double temp;
   
     temp=x*param.x+y*param.y+z*param.z;
     
     return(temp);
}
//临时添加，以便用于已知alpha，beta得到gamma的情况
//===============================================
CVector3d CVector3d::operator/(CVector3d param)
{
     CVector3d temp;
     temp.x=x/param.x;
     temp.y=y/param.y;
     temp.z=z/param.z;
     return(temp);
}
CVector3d CVector3d::operator+(double para)
{
    CVector3d temp;
    temp.x=x+para;
    temp.y=y+para;
    temp.z=z+para;
    return (temp);
}
//===================================================
/*!
    \fn CVector3d::operator||(CVector3d)
 */
CVector3d CVector3d::operator||(CVector3d param)
{
   CVector3d temp;
   
   temp.x=y*param.z-z*param.y;
   temp.y=z*param.x-x*param.z;
   temp.z=x*param.y-y*param.x;
   
   return(temp);
  
}

void CVector3d::setCVector3d(double rx, double ry, double rz)
{
	x=rx;
	y=ry;
	z=rz;
}

double CVector3d::getX( ) const
{
	return x;
}

double CVector3d::getY( ) const
{
	return y;
}

double CVector3d::getZ( ) const
{
	return z;
}

void CVector3d::setX(double p)
{
	x=p;
}

void CVector3d::setY(double p)
{
	y=p;
}

void CVector3d::setZ(double p)
{
	z=p;
}
